<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script>
    function loadXMLDoc() {
        const data = {
            'username': "test1",
            'password':"123456",
        };
        const options = {
            method: 'POST',
            headers: { 'content-type': 'multipart/form-data' },
            data: data,
            url: "http://127.0.0.1/blog/public/user/login",
            
            success:function(data){
            //data=JSON.parse(data)  //解析JSON字符串为JSON数据 方法二;
            console.log(data);
            }
        }
        axios(options);
    }
    </script>
     
</head>
<body>
    <div id="myDiv"><h2>提交</h2></div>
    <button type="submit" onclick="loadXMLDoc()">提交</button>
    </html>